package com.gaofeng.day02;

import java.util.Scanner;

public class planeTicket {
    public static void main(String[] args) {
        //键盘录入机票价格，月份头等舱或经济舱
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入机票的价格：");
        int ticket = sc.nextInt();
        System.out.println("请输入月份：");
        int month = sc.nextInt();
        System.out.println("请输入仓位等级: 0 头等舱 1 经济舱");
        int seat = sc.nextInt();
        //判断月份是淡季还是旺季
         if(month >=5 && month <= 10){
             // 0 => .9 1 => .85
             ticket =  getPrice(seat,ticket,.9,.85);
         }else if(month >=1 && month <= 4 || month == 11 || month == 12){
             //0 => .7 1 => .65
             ticket = getPrice(seat,ticket,.7,.65);
         }else{
             //非法数据
             System.out.println("数据不合法...");
         }
        //
        System.out.println(ticket);
    }

    public static int getPrice(int seat,int ticket,double v0,double v1){
        if(seat == 0){
            ticket =  (int)(ticket * v0) ;
        }else if(seat == 1){
            ticket =  (int)(ticket * v1) ;
        }else{
            System.out.println("没有这个仓位");
        }
        return ticket;
    }
}
